package Year21_Month12.day1215;

public class Solution {
    public ListNode reverseList(ListNode head) {
        return reverseList(null,head);
    }
    public ListNode reverseList(ListNode time,ListNode slow){
        if(slow == null){
            return time;
        }
        ListNode fast = slow.next;
        slow.next = time;
        return reverseList(slow,fast);
    }

    public ListNode reverseList2(ListNode head) {
        ListNode pre = null;
        ListNode mid = head;
        ListNode cur = null;
        while(mid != null){
            cur = mid.next;
            mid.next = pre;
            pre = mid;
            mid = cur;
        }
        return pre;
    }
}
